/* 
 * File:   Parameters.cpp
 * Author: Gab'z
 * 
 * Created on 27 mai 2012, 17:41
 */

#include "Parameters.h"

namespace calculator {

    Parameters* Parameters::instance = 0;

    Parameters* Parameters::getInstance() {
        if (instance == 0) {
            instance = new Parameters();
        }
        return instance;
    }

    void Parameters::deleteInstance() {
        if (instance != 0) delete instance;
    }

    Parameters::Parameters() {
        _constantType = Parameters::REAL;
        _angleUnit = Parameters::DEGREE;
        _complexMode = false;
        _displayKeyboard = true;
        _visibleStackSize = 10;
        _instantCompute = true;
        _integerDivision = false;
        _saveOnExit = true;
    }

    Parameters::Parameters(const Parameters& parameters) :
    _constantType(parameters._constantType),
    _angleUnit(parameters._angleUnit),
    _complexMode(parameters._complexMode),
    _displayKeyboard(parameters._displayKeyboard),
    _visibleStackSize(parameters._visibleStackSize),
    _instantCompute(parameters._instantCompute),
    _integerDivision(parameters._integerDivision),
    _saveOnExit(parameters._saveOnExit) {
    }

    Parameters::Parameters(ConstantType constantType,
            AngleUnit angleUnit,
            bool complexMode,
            bool displayKeyboard,
            int visibleStackSize,
            bool instantCompute,
            bool integerDivision,
            bool saveOnExit) :
    _constantType(constantType),
    _angleUnit(angleUnit),
    _complexMode(complexMode),
    _displayKeyboard(displayKeyboard),
    _visibleStackSize(visibleStackSize),
    _instantCompute(instantCompute),
    _integerDivision(integerDivision),
    _saveOnExit(saveOnExit) {
    }

    Parameters::~Parameters() {
    }

    Parameters* Parameters::clone() const {
        return new Parameters(*this);
    }

}
